package com.sunbim.rsrv.mapper;

import com.sunbim.rsrv.pojo.Storage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sunbim.rsrv.vo.storage.StorageVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author yuhui
 * @since 2021-12-30
 */
@Mapper
public interface StorageMapper extends BaseMapper<Storage> {

    @Select("select id, storage_type,storage_url,storage_name, storage_desc, create_time, update_time from storage where (relics_id = #{relicsId} and storage_type=#{type})")
    List<StorageVo> selectByRelicsIdAndType(int relicsId, String type);

    @Select("select count(1) from storage where id=#{id}")
    boolean idExit(Integer id);

    List<Map<String, Object>> getReports(Integer relicsId);
}
